<template>
    <view class="content">
        <view class="box" v-for="(item, index) in list" :key="index">
			<image src="../../static/image/bg_3.png" class="bg-3"></image>
			<view class="item">
				<view>一诺健康管理卡</view>
				<view class="num">NO.{{item.card_no}}</view>
				<view class="info">
					<image :src="item.members.image_uri || '../../static/icon/avatar.png'" class="avatar"></image>
					<view class="u-flex-1">
						<view class="name" v-if="item.members && item.members.nickname">
							{{item.members.nickname}}
						</view>
						<view class="time">{{item.create_time}}{{item.status_txt}}</view>
					</view>
				</view>
			</view>
		</view>
		
		<view style="height: 94rpx;padding-top: 30rpx;">
		    <u-loadmore :status="status" v-if="status != 'loadmore'" />
		</view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                status: 'loadmore', //是否显示没有更多了
                page: 1,
                list: [],
            };
        },
        onLoad() {
            this.getList()
        },
    	onReachBottom() {
    		if(this.page == 1){return}
    		this.getList()
    	},
        methods: {
            getList() {
            	if (this.status == 'nomore') return;
            	this.status = 'loading';
            	this.$ajax('get_transfer', {
                    userToken: this.$getSync('userToken'),
                    page: this.page,
                    limit: 10,
                }).then(ret => {
            		if (ret.status == 0) {
                        if (ret.data.length > 0) {
                        	this.list = this.list.concat(ret.data);
                        	this.page++;
                        	this.status = 'loadmore'
                        } else {
                        	this.status = 'nomore'
                        }
            		} else {
            			this.$toast(ret.message);
            		}
            	});
            },
        }
    };
</script>

<style lang="scss">
    page{
        background-color: #f5f5f5;
    }
	.content{
		padding: 30rpx 20rpx;
	}
	.box{
		margin-bottom: 30rpx;
		position: relative;
	}
	.bg-3{
		width: 710rpx;
		height: 348rpx;
	}
	.item{
		width: 710rpx;
		height: 348rpx;
		padding: 40rpx;
		position: absolute;
		top: 0;
		left: 0;
		font-size: 30rpx;
		color: #fff;
	}
	.num{
		font-size: 44rpx;
		font-weight: bold;
		padding: 50rpx 0;
	}
	.info{
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
	.avatar{
		width: 65rpx;
		height: 65rpx;
		border: 2rpx solid #fff;
		border-radius: 50%;
		margin-right: 14rpx;
	}
	.name{
		font-weight: bold;
	}
	.time{
		font-size: 24rpx;
	}
	
	

</style>
